package com.myoffice.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;

/**
 * TUserinfo entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "T_USERINFO", schema = "OA", uniqueConstraints = @UniqueConstraint(columnNames = "NAME"))
public class TUserinfo implements java.io.Serializable {

	// Fields

	private String id;
	private TRoleinfo TRoleinfo;
	private TUserstate TUserstate;
	private String name;
	private String password;
	private String departid;
	private String gender;
	private Date createdatetime;
	private Date modifydatetime;
	private Set<TLoginlog> TLoginlogs = new HashSet<TLoginlog>(0);
	private Set<TMynote> TMynotes = new HashSet<TMynote>(0);
	private Set<TOperatelog> TOperatelogs = new HashSet<TOperatelog>(0);

	// Constructors

	/** default constructor */
	public TUserinfo() {
	}

	/** minimal constructor */
	public TUserinfo(String id, String name, String password, String gender) {
		this.id = id;
		this.name = name;
		this.password = password;
		this.gender = gender;
	}

	/** full constructor */
	public TUserinfo(String id, TRoleinfo TRoleinfo, TUserstate TUserstate,
			String name, String password, String departid, String gender,
			Date createdatetime, Date modifydatetime,
			Set<TLoginlog> TLoginlogs, Set<TMynote> TMynotes,
			Set<TOperatelog> TOperatelogs) {
		this.id = id;
		this.TRoleinfo = TRoleinfo;
		this.TUserstate = TUserstate;
		this.name = name;
		this.password = password;
		this.departid = departid;
		this.gender = gender;
		this.createdatetime = createdatetime;
		this.modifydatetime = modifydatetime;
		this.TLoginlogs = TLoginlogs;
		this.TMynotes = TMynotes;
		this.TOperatelogs = TOperatelogs;
	}

	// Property accessors
	@Id
	@Column(name = "ID", unique = true, nullable = false)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ROLEID")
	public TRoleinfo getTRoleinfo() {
		return this.TRoleinfo;
	}

	public void setTRoleinfo(TRoleinfo TRoleinfo) {
		this.TRoleinfo = TRoleinfo;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "USERSTATE")
	public TUserstate getTUserstate() {
		return this.TUserstate;
	}

	public void setTUserstate(TUserstate TUserstate) {
		this.TUserstate = TUserstate;
	}

	@Column(name = "NAME", unique = true, nullable = false)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Column(name = "PASSWORD", nullable = false)
	public String getPassword() {
		return this.password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	@Column(name = "DEPARTID")
	public String getDepartid() {
		return this.departid;
	}

	public void setDepartid(String departid) {
		this.departid = departid;
	}

	@Column(name = "GENDER", nullable = false, length = 2)
	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "CREATEDATETIME", length = 7)
	public Date getCreatedatetime() {
		return this.createdatetime;
	}

	public void setCreatedatetime(Date createdatetime) {
		this.createdatetime = createdatetime;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "MODIFYDATETIME", length = 7)
	public Date getModifydatetime() {
		return this.modifydatetime;
	}

	public void setModifydatetime(Date modifydatetime) {
		this.modifydatetime = modifydatetime;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "TUserinfo")
	public Set<TLoginlog> getTLoginlogs() {
		return this.TLoginlogs;
	}

	public void setTLoginlogs(Set<TLoginlog> TLoginlogs) {
		this.TLoginlogs = TLoginlogs;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "TUserinfo")
	public Set<TMynote> getTMynotes() {
		return this.TMynotes;
	}

	public void setTMynotes(Set<TMynote> TMynotes) {
		this.TMynotes = TMynotes;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "TUserinfo")
	public Set<TOperatelog> getTOperatelogs() {
		return this.TOperatelogs;
	}

	public void setTOperatelogs(Set<TOperatelog> TOperatelogs) {
		this.TOperatelogs = TOperatelogs;
	}

}